﻿@model MVC.Models.ReadBook

<h3>Are you sure you want to remove this book from your list?</h3>
<div>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.Book.Title)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Book.Title)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Book.Author)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Book.Author)
        </dd>
        
        <dt>
            @Html.DisplayNameFor(model => model.Book.Description)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Book.Description)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Rating)
        </dt>

        <dd>
            <div class="rateit" id="rateit" data-rateit-value="@Model.Rating">
            </div>

            <script type="text/javascript">
                var tooltipvalues = ['Hated It', 'Didn\'t Like it', 'Liked It', 'Really Liked It', 'Loved It'];
                $("#rateit").bind('hover', function(event, value) { $(this).attr('title', tooltipvalues[value - 1]); });
            </script>
            <script type="text/javascript">
                $('.rateit').bind('rated reset', function(e) {
                    var ri = $(this);
                    var value = ri.rateit('value');
                    var readBookId = @Model.ReadBookId;

                    $.ajax({
                        url: '/BookList/Rate/' + readBookId, //your server side script
                        data: { rating: value }, //our data
                        type: 'PUT'
                    });
                });
            </script>

        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.DateRead)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.DateRead)
        </dd>
        <dd>
            @using (Html.BeginForm())
            {
                @Html.AntiForgeryToken()
                <div class="form-actions no-color">
                    <input type="submit" value="Remove" class="btn btn-default" />
                </div>
            }
        </dd>
    </dl>



<div class="form-actions no-color">
    @Html.ActionLink("Back to List", "Index")
</div>
</div>
